package com.ex.mina;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;

import com.ex.util.LogUtil;

public class MinaIoHandler extends IoHandlerAdapter{
	
//	private SocketListener listener;
//	
//	public MinaIoHandler(SocketListener listener) {
//		this.listener = listener;
//	}
	
	@Override
	public void sessionCreated(IoSession session) throws Exception {
		super.sessionCreated(session);
		LogUtil.mina("sessionCreated");
	}
	
	@Override
	public void sessionOpened(IoSession session) throws Exception {
		super.sessionOpened(session);
		LogUtil.mina("sessionOpened");
	}
	
	@Override
	public void messageReceived(IoSession session, Object message)
			throws Exception {
		super.messageReceived(session, message);
		LogUtil.mina("messageReceived : " + message);
		
	}
	
	@Override
	public void messageSent(IoSession session, Object message) throws Exception {
		super.messageSent(session, message);
		LogUtil.mina("messageSent: " + message);
	}
	
	@Override
	public void exceptionCaught(IoSession session, Throwable cause)
			throws Exception {
		super.exceptionCaught(session, cause);
		LogUtil.mina("exceptionCaught");
	}
	
	@Override
	public void sessionClosed(IoSession session) throws Exception {
		super.sessionClosed(session);
		LogUtil.mina("sessionClosed");
	}

}
